<body class="app" data-ad="true">
<?php $CDN= $this->CommonHelper()->imageDomain();?>
<section class="app-content">
	<section class="page page-index page-b noline" data-plugin-type="info_front">

        <div class="swiper-banner">
            <ul class="swiper-wrapper">
	            <?php 
	            	$banners=$this->banners;
	            ?>
	            <?php foreach($banners as $banner): ?>
					<li class="swiper-slide"><img src="<?php echo "{$CDN}{$banner['image']}"?>"></li>
	            <?php endforeach;?>
            </ul>
            <div class="pagination-banner"></div>
        </div>

        <div class="info-list bw mt20 seller-info-ct">
            <h3 class="source-tit">材料或单位</h3>
            <dl style="display: none;">
                <dt class="i-title">&nbsp;</dt>
                <dd><input id="materialId" type="text" value="<?php echo $this->materialDetail['material_id'] ?>"></dd>
            </dl>
            <dl>
                <dt class="i-title"><b>名称</b></dt>
                <dd><?php echo $this->materialDetail['material_name'] ?></dd>
            </dl>
            <dl>
                <dt class="i-title"><b>类目</b></dt>
                <dd><?php echo $this->materialDetail['material_category_name'] ?></dd>
            </dl>
            <dl>
                <dt class="i-title"><b>供应商</b></dt>
                <dd><?php echo $this->materialDetail['material_supplier'] ?></dd>
            </dl>
            <dl>
                <dt class="i-title"><b>供应商资质</b></dt>
                <dd>
	                <?php 
	                	$materialSupplierImg=array();
	                	$materialSupplierImg[]=$this->materialDetail['material_supplier_img1'];
	                	$materialSupplierImg[]=$this->materialDetail['material_supplier_img2'];
	                	$materialSupplierImg[]=$this->materialDetail['material_supplier_img3'];
	                	$materialSupplierImg[]=$this->materialDetail['material_supplier_img4'];
	                	$materialSupplierImg[]=$this->materialDetail['material_supplier_img5'];
	                	$materialSupplierImg[]=$this->materialDetail['material_supplier_img6'];
	                	$materialSupplierImg[]=$this->materialDetail['material_supplier_img7'];
	                	$materialSupplierImg[]=$this->materialDetail['material_supplier_img8'];
	                ?>
					<?php foreach($materialSupplierImg as $img):?>
					<?php if($img):?>
					<img src="<?php echo "{$CDN}{$img}";?>" class="p-lic">
					<?php endif;?>
					<?php endforeach;?>
                    <!--img src="images/temp/license.jpg" class="p-lic"><img src="images/temp/license.jpg" class="p-lic"><img src="images/temp/license.jpg" class="p-lic"><img src="images/temp/license.jpg" class="p-lic">
                    <img src="images/temp/license.jpg" class="p-lic"><img src="images/temp/license.jpg" class="p-lic"><img src="images/temp/license.jpg" class="p-lic"-->
                </dd>
            </dl>
            <dl>
                <dt class="i-title"><b>生产日期</b></dt>
                <dd><?php echo $this->materialDetail['material_production_date'] ?></dd>
            </dl>
            <dl>
                <dt class="i-title"><b>生产商/地</b></dt>
                <dd><?php echo $this->materialDetail['material_yieldly'] ?></dd>
            </dl>
            <dl>
                <dt class="i-title"><b>批次</b></dt>
                <dd><?php echo $this->materialDetail['material_batch_no'] ?></dd>
            </dl>
            <dl>
                <dt class="i-title"><b>保质期</b></dt>
                <dd><?php echo $this->materialDetail['material_expiry_date'] ?></dd>
            </dl>
            <dl>
                <dt class="i-title"><b>图片展示</b></dt>
                <dd>
                	<?php 
                		$materialImg=array();
                		$materialImg=json_decode($this->materialDetail['material_img']);
                	?>
                	<?php if(is_array($materialImg)&&count($materialImg)>0):?>
                	<?php foreach($materialImg as $img):?>
                	<img src="<?php echo "{$CDN}{$img}"; ?>" class="p-lic">
                	<?php endforeach;?>
                	<?php endif;?>
                    <!--img src="images/temp/license.jpg" class="p-lic"><img src="images/temp/license.jpg" class="p-lic"><img src="images/temp/license.jpg" class="p-lic"><img src="images/temp/license.jpg" class="p-lic">
                    <img src="images/temp/license.jpg" class="p-lic"><img src="images/temp/license.jpg" class="p-lic"><img src="images/temp/license.jpg" class="p-lic"-->
                </dd>
            </dl>
            <dl>
                <dt class="i-title"><b>其它</b></dt>
                <dd><?php echo $this->materialDetail['material_other'] ?></dd>
            </dl>
        </div>

        <div class="info-list bw mt20">
            <dl>
                <dt class="i-title"><b>最新监测报告</b></dt>
                <dd>&nbsp;</dd>
            </dl>
            <div id="imgReport" class="pic-list">
                <?php foreach($this->monitorReports as $k=>$monitorReport):?>
                <img src="<?php echo "{$CDN}{$monitorReport['image']}"; ?>">
                <?php endforeach;?>
            </div>
        </div>
	</section>

    <div class="source-b-bar">
        <div class="cal-wrap">
            <select id="cal-year">
            	<?php foreach($this->_date['y'] as $year):?>
            	<option value='<?php echo "{$year}"; ?>'><?php echo "{$year}"?></option>
            	<?php endforeach;?>
            </select><span>年</span>
            <select id="cal-month">
                <?php foreach($this->_date['m'] as $month):?>
            	<option value='<?php echo "{$month}"; ?>'><?php echo "{$month}"?></option>
            	<?php endforeach;?>
            </select><span>月</span>
            <select id="cal-day">
                <?php foreach($this->_date['d'] as $day):?>
            	<option value='<?php echo "{$day}"; ?>'><?php echo "{$day}"?></option>
            	<?php endforeach;?>
            </select><span>日</span>
        </div>
        <a class="btn-cal-search" href="javascript:searchReport();">查 询</a>
    </div>

    <!-- 底部menu-->
    <?php echo $this->partial('public/menu.phtml'); ?>
</section>

<script type="text/javascript">
var mReport="<img src='' />";
var $mReport=$(mReport);
var CDN ='<?php echo "{$CDN}";?>';

function searchReport(){
	var year=$("#cal-year").val();
	var month=$("#cal-month").val();
	var day=$("#cal-day").val();
	var materialId=$("#materialId").val();
	$.ajax({
		url:"/material/searchReport",
		type:"post",
		data:{year:year,month:month,day:day,materialId:materialId},
		dataType:"json",
		success:function(rs){
			var imgHtml="";
			for(var i=0;i<rs.length;i++){
				$mReport.attr("src",CDN+rs[i]['image']);
				imgHtml += $mReport.prop('outerHTML');
			}
			$("#imgReport").html(imgHtml);
		}
	});
	
}
                	
$(function () {
    var swiper = new Swiper('.swiper-banner', {
        pagination: '.pagination-banner',
        paginationClickable: true,
        loop: true,
        autoplay: 5000
    });
});
</script>
